package ai.people.netmon.msgsearch.mapstruct;

import ai.people.netmon.framework.domain.searchmsg.vo.InformationSearchListRespVO;
import ai.people.netmon.framework.domain.searchmsg.vo.TgListRespFieldsVO;
import ai.people.netmon.msgsearch.domain.entity.TelegramAccountRegisterInfo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper(componentModel = "spring")
public interface TgInformationSearchListRespConverter {

    @Mappings({
            @Mapping(source = "id", target = "dataId"),
            @Mapping(source = "userName", target = "fields.userName"),
            @Mapping(source = "phone", target = "fields.phone"),
            @Mapping(source = "id", target = "fields.id"),
            @Mapping(target = "fields.platform", source = "platform")
    })
    InformationSearchListRespVO<TgListRespFieldsVO> infoData2Vo(TelegramAccountRegisterInfo infoData);

    @Mappings({
            @Mapping(source = "id", target = "dataId"),
            @Mapping(source = "userName", target = "fields.userName"),
            @Mapping(source = "phone", target = "fields.phone"),
            @Mapping(source = "id", target = "fields.id"),
            @Mapping(target = "fields.platform", source = "platform")
    })
    List<InformationSearchListRespVO<TgListRespFieldsVO>> infoDataList2VoList(List<TelegramAccountRegisterInfo> infoDataList);

}
